import Vue from 'vue'
import App from './App'
import uView from "uview-ui";
import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)
Vue.use(uView);
//引入vuex
import store from './store'

//把vuex定义成全局组件
Vue.prototype.$store = store

Vue.config.productionTip = false

App.mpType = 'app'

uni.$showMsg = function(title = "数据加载失败!", duration = 1500) {
	uni.showToast({
		title,
		duration,
		icon: "none"
	})
}

// 天 小时  分钟
Vue.filter('capitalize', function(mss) {
	console.log('mss :>> ', mss);
	// 毫秒
	let days = Math.floor(mss / (1000 * 60 * 60 * 24));
	let hours = Math.floor((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
	let minutes = Math.floor((mss % (1000 * 60 * 60)) / (1000 * 60));
	let seconds = Math.round((mss % (1000 * 60)) / 1000);
	return days + "天" + hours + "小时" + minutes + "分"+ seconds+'秒';
})
// 隐藏 车排行
Vue.filter('hide', function(mss) {
	const numBegin = mss.substring(0, 2);
	const numEnd = mss.substring(7);
	return numBegin + '****' + numEnd;

})
// 不保留小数
Vue.filter('decimal', function(mss) {
	return Number(mss).toFixed()

})




const app = new Vue({
	...App,
	// 挂载
	store
})
app.$mount()
